home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / dalla rivista / host contacted / imengv3.41p1.lha / ImEngV3.41p1 / ARexx / AddSpaceB.rexx < prev    next >
OS/2 REXX Batch file  |  1999-04-08  |  3KB  |  178 lines

  1. /*
  2.  
  3.    v1.07 AddSpace B
  4.  
  5.    Marko Seppänen
  6.    marko.seppanen@wwnet.fi
  7.  
  8. */
  9.  
  10.  
  11. address IMAGEENGINEER
  12.  
  13. Options results
  14. signal on error            /* Setup a place for errors to go */
  15.  
  16.  
  17. if arg()=0 then exit
  18. x=arg(1)
  19. parse var x pic bg side value .
  20.  
  21.  
  22.  
  23. MARK pic PRIMARY
  24. PROJECT_INFO pic WIDTH
  25. picwidth=result
  26. PROJECT_INFO pic HEIGHT
  27. picheight=result
  28. PROJECT_INFO pic ZOOM
  29. origzoomval=result
  30.  
  31.  
  32. if bg="" then do
  33.  
  34.   if exists("ie:prefs/veaddspaceb.cfg") == "1" then
  35.     do
  36.       call open("temp","ie:prefs/veaddspaceb.cfg","R")
  37.       values=readln("temp")
  38.       parse var values ok bg side value .
  39.       call close("temp")
  40.     end
  41.   else
  42.     do
  43.       bg=0
  44.       side=0
  45.       value=100
  46.     end
  47.  
  48.   'FORM "Add Space B" "Use|Cancel"',
  49.   'CYCLE,"Background color","White|Black|Guess",'bg'',
  50.   'CYCLE,"Side","Top|Bottom|Left|Right",'side'',
  51.   'INTEGER,"Space to add",1,1000,'value',SLIDER'
  52.  
  53.   values=result
  54.   parse var values ok bg side value .
  55.  
  56.   if ok = 0 then exit
  57.  
  58.   call open("temp","ie:prefs/veaddspaceb.cfg","W")
  59.   res=writeln("temp",values)
  60.   call close("temp")
  61.  
  62. end
  63.  
  64.  
  65.  
  66. select
  67.  
  68.   when side=="0" | upper(side)=="TOP" then
  69.  
  70.     do
  71.       offsetx=0
  72.       offsety=value
  73.       xamount=0
  74.       yamount=value
  75.     end
  76.  
  77.   when side=="1" | upper(side)=="BOTTOM" then
  78.  
  79.     do
  80.       offsetx=0
  81.       offsety=0
  82.       xamount=0
  83.       yamount=value
  84.     end
  85.  
  86.   when side=="2" | upper(side)=="LEFT" then
  87.  
  88.     do
  89.       offsetx=value
  90.       offsety=0
  91.       xamount=value
  92.       yamount=0
  93.     end
  94.  
  95.   when side=="3" | upper(side)=="RIGHT" then
  96.  
  97.     do
  98.       offsetx=0
  99.       offsety=0
  100.       xamount=value
  101.       yamount=0
  102.     end
  103.  
  104. otherwise exit
  105. end
  106.  
  107.  
  108. if value=="" then do
  109.  
  110.   'REQUEST "Value is missing!" "Sorry"'
  111.   exit
  112.  
  113. end
  114.  
  115.  
  116. select
  117.  
  118.   when bg == 0 | upper(bg)=="WHITE" then do
  119.       BRIGHTNESS pic 255
  120.       bgcolor=result
  121.       RESIZE bgcolor picwidth+xamount picheight+yamount TILE
  122.       bgcolor2=result
  123.       CLOSE bgcolor
  124.       MARK bgcolor2 SECONDARY
  125.       COMPOSITE offsetx offsety MIN
  126.       pic2=result
  127.   end
  128.   when bg == 1 | upper(bg)=="BLACK" then do
  129.       BRIGHTNESS pic "-255"
  130.       bgcolor=result
  131.       RESIZE bgcolor picwidth+xamount picheight+yamount TILE
  132.       bgcolor2=result
  133.       CLOSE bgcolor
  134.       MARK bgcolor2 SECONDARY
  135.       COMPOSITE offsetx offsety MAX
  136.       pic2=result
  137.   end
  138.   when bg == 2 | upper(bg)=="GUESS" then do
  139.       CROP pic picwidth-1 picheight-1 picwidth-1 picheight-1
  140.       bgpixel=result
  141.       RESIZE bgpixel picwidth+xamount picheight+yamount TILE
  142.       bgcolor2=result
  143.       CLOSE bgpixel
  144.       MARK bgcolor2 SECONDARY
  145.       COMPOSITE offsetx offsety MIX 100
  146.       pic2=result
  147.   end
  148.  
  149. otherwise exit
  150. end
  151.  
  152.  
  153. CLOSE bgcolor2
  154.  
  155.  
  156. PROJECT_SET pic2 ZOOM origzoomval
  157.  
  158.  
  159. exit
  160.  
  161. /*******************************************************************/
  162. /* This is where control goes when an error code is returned by IE */
  163. /* It puts up a message saying what happened and on which line     */
  164. /*******************************************************************/
  165. error:
  166. if RC=5 then do            /* Did the user just cancel us? */
  167.     IE_TO_FRONT
  168.     LAST_ERROR
  169.     'REQUEST "'||RESULT||'"'
  170.     exit
  171. end
  172. else do
  173.     IE_TO_FRONT
  174.     LAST_ERROR
  175.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  176.     exit
  177. end
  178.